<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
  var is_perfect = function(num){
        var sum = 0;
        for (var i = 5; i > 0; i--){
            if (num % i == 0)
                sum += i;
    }
        if (sum == num)
            return (1);
        else
            return (0);
 }
        console.log(is_perfect(5));
  </script>
</head>
<body>
  
</body>
</html>